<?php

namespace app\common\model;

use think\Model;


class SecureCheck extends Model
{

    

    

    // 表名
    protected $name = 'secure_check';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'xfs_status_text',
        'mhq_status_text',
        'glfh_status_text',
        'sbby_status_text',
        'clwz_status_text',
        'jlsb_status_text'
    ];
    

    
    public function getXfsStatusList()
    {
        return ['1' => __('Xfs_status 1'), '2' => __('Xfs_status 2')];
    }

    public function getMhqStatusList()
    {
        return ['1' => __('Mhq_status 1'), '2' => __('Mhq_status 2')];
    }

    public function getGlfhStatusList()
    {
        return ['1' => __('Glfh_status 1'), '2' => __('Glfh_status 2')];
    }

    public function getSbbyStatusList()
    {
        return ['1' => __('Sbby_status 1'), '2' => __('Sbby_status 2')];
    }

    public function getClwzStatusList()
    {
        return ['1' => __('Clwz_status 1'), '2' => __('Clwz_status 2')];
    }

    public function getJlsbStatusList()
    {
        return ['1' => __('Jlsb_status 1'), '2' => __('Jlsb_status 2')];
    }


    public function getXfsStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['xfs_status']) ? $data['xfs_status'] : '');
        $list = $this->getXfsStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getMhqStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['mhq_status']) ? $data['mhq_status'] : '');
        $list = $this->getMhqStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getGlfhStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['glfh_status']) ? $data['glfh_status'] : '');
        $list = $this->getGlfhStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getSbbyStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['sbby_status']) ? $data['sbby_status'] : '');
        $list = $this->getSbbyStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getClwzStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['clwz_status']) ? $data['clwz_status'] : '');
        $list = $this->getClwzStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getJlsbStatusTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['jlsb_status']) ? $data['jlsb_status'] : '');
        $list = $this->getJlsbStatusList();
        return isset($list[$value]) ? $list[$value] : '';
    }




    public function admin()
    {
        return $this->belongsTo('Admin', 'user_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }


    public function stand()
    {
        return $this->belongsTo('Stand', 'stand_id', 'id', [], 'LEFT')->setEagerlyType(0);
    }
}
